home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / Timing.p < prev    next >
Text File  |  1996-05-01  |  4KB  |  112 lines

  1. {
  2.      File:        Timing.p
  3.  
  4.      Contains:    Kernel Timing Interfaces.
  5.  
  6.      Version:    Technology:    System 8
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT Timing;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __TIMING__}
  28. {$SETC __TIMING__ := 1}
  29.  
  30. {$I+}
  31. {$SETC TimingIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37.  
  38. {$PUSH}
  39. {$ALIGN POWER}
  40. {$LibExport+}
  41.  
  42. {$IFC FOR_SYSTEM8_PREEMPTIVE }
  43.  
  44. CONST
  45.     kDurationMicrosecond        = -1;                            {  Microseconds are negative  }
  46.     kDurationMillisecond        = 1;                            {  Milliseconds are positive }
  47.     kDurationSecond                = 1000;                            {  1000 * durationMillisecond }
  48.     kDurationMinute                = 60000;                        {  60 * durationSecond, }
  49.     kDurationHour                = 3600000;                        {  60 * durationMinute, }
  50.     kDurationDay                = 86400000;                        {  24 * durationHour, }
  51.     kDurationNoWait                = 0;                            {  don't block }
  52.     kDurationForever            = $7FFFFFFF;                    {  no time limit }
  53.  
  54. {$IFC OLDROUTINENAMES }
  55.     durationMicrosecond            = -1;
  56.     durationMillisecond            = 1;
  57.     durationSecond                = 1000;
  58.     durationMinute                = 60000;
  59.     durationHour                = 3600000;
  60.     durationDay                    = 86400000;
  61.     durationNoWait                = 0;
  62.     durationForever                = $7FFFFFFF;
  63.  
  64. {$ENDC}
  65.  
  66. TYPE
  67.     Nanoseconds                            = UInt64;
  68.     NanosecondsPtr                         = ^Nanoseconds;
  69.     Ticks                                = UInt32;
  70. {
  71.     Time Information Routines
  72. }
  73. FUNCTION UpTime: AbsoluteTime; C;
  74. FUNCTION TaskCPUTime: AbsoluteTime; C;
  75. PROCEDURE GetTimeBaseInfo(VAR theMinAbsoluteTimeDelta: UInt32; VAR theAbsoluteTimeToNanosecondNumerator: UInt32; VAR theAbsoluteTimeToNanosecondDenominator: UInt32; VAR theProcessorToAbsoluteTimeNumerator: UInt32; VAR theProcessorToAbsoluteTimeDenominator: UInt32); C;
  76. {
  77.     Timing Conversion Routines
  78. }
  79. FUNCTION AbsoluteToNanoseconds(theAbsoluteTime: AbsoluteTime): Nanoseconds; C;
  80. FUNCTION AbsoluteToDuration(theAbsoluteTime: AbsoluteTime): Duration; C;
  81. FUNCTION NanosecondsToAbsolute(theNanoseconds: Nanoseconds): AbsoluteTime; C;
  82. FUNCTION DurationToAbsolute(theDuration: Duration): AbsoluteTime; C;
  83. FUNCTION DurationToNanoseconds(theDuration: Duration): Nanoseconds; C;
  84. FUNCTION NanosecondsToDuration(theNanoseconds: Nanoseconds): Duration; C;
  85. FUNCTION AbsoluteToTicks(theAbsoluteTime: AbsoluteTime): Ticks; C;
  86. FUNCTION TicksToAbsolute(theTicks: Ticks): AbsoluteTime; C;
  87. {
  88.     AbsoluteTime Adjustment Routines
  89. }
  90. FUNCTION AddAbsoluteToAbsolute(theAbsoluteTime1: AbsoluteTime; theAbsoluteTime2: AbsoluteTime): AbsoluteTime; C;
  91. FUNCTION SubAbsoluteFromAbsolute(theLeftAbsoluteTime: AbsoluteTime; theRightAbsoluteTime: AbsoluteTime): AbsoluteTime; C;
  92. FUNCTION AddNanosecondsToAbsolute(theNanoseconds: Nanoseconds; theAbsoluteTime: AbsoluteTime): AbsoluteTime; C;
  93. FUNCTION AddDurationToAbsolute(theDuration: Duration; theAbsoluteTime: AbsoluteTime): AbsoluteTime; C;
  94. FUNCTION SubNanosecondsFromAbsolute(theNanoseconds: Nanoseconds; theAbsoluteTime: AbsoluteTime): AbsoluteTime; C;
  95. FUNCTION SubDurationFromAbsolute(theDuration: Duration; theAbsoluteTime: AbsoluteTime): AbsoluteTime; C;
  96. {
  97.     Timing Delta Routines
  98. }
  99. FUNCTION AbsoluteDeltaToNanoseconds(theLeftAbsoluteTime: AbsoluteTime; theRightAbsoluteTime: AbsoluteTime): Nanoseconds; C;
  100. FUNCTION AbsoluteDeltaToDuration(theLeftAbsoluteTime: AbsoluteTime; theRightAbsoluteTime: AbsoluteTime): Duration; C;
  101. {$ENDC}
  102. {$ALIGN RESET}
  103. {$POP}
  104.  
  105. {$SETC UsingIncludes := TimingIncludes}
  106.  
  107. {$ENDC} {__TIMING__}
  108.  
  109. {$IFC NOT UsingIncludes}
  110.  END.
  111. {$ENDC}
  112.